package com.todo.common.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/4/7 20:54
 * @description
 */
@Getter
@AllArgsConstructor
public enum CreateSourceEnum {
    PLATFORM(1, "PLATFORM", "平台"),
    ACTIVITY(2, "ACTIVITY", "活动"),
    USER(3, "USER", "用户创作"),
    ;

    private static Map<Integer, CreateSourceEnum> typeMap = Arrays
            .stream(CreateSourceEnum.values())
            .collect(Collectors.toMap(CreateSourceEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static CreateSourceEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
